package com.chorye.function.schedule.task;

import com.chorye.function.schedule.service.QuartzService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.PersistJobDataAfterExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 定义定时任务，只需继承Job接口，实现execute方法
 * DisallowConcurrentExecution：不允许并发执行
 * PersistJobDataAfterExecution：保存工作数据后执行
 *
 * @author Chorye
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Component
public class CheckStatusTask implements Job {

    /**
     * 日志工具
     */
    private final Logger log = LoggerFactory.getLogger(QuartzService.class);

    /**
     * 要执行的定时任务
     *
     * @param context 定时任务执行上下文
     */
    @Override
    public void execute(JobExecutionContext context) {
        log.info("===============定时执行中==============");
    }
}